from queue import Queue

maxn = int(1e5 + 7)
G = [[] for i in range(maxn)]  # G[u]中放u与哪些点有边


def bfs(s):
    vis = [False for u in range(maxn)]
    q = Queue()
    q.put(s)
    vis[s] = True
    while q.qsize() != 0:
        u = q.get()
        # 这儿有点处理
        for v in G[u]:
            if not vis[v]:
                q.put(v)
                vis[v] = True
